﻿<%@ Page Language="C#" MasterPageFile="~/Template.master" AutoEventWireup="true" CodeFile="Accounting.aspx.cs" Inherits="AccountingPage" Title="Ghasam Co. Accounting" %>
<%@ Register
    Assembly="AjaxControlToolkit"
    Namespace="AjaxControlToolkit"
    TagPrefix="ajaxToolkit" %>
    
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:ScriptManager ID="smAccounting" runat="server" />
    <div class="title">
        <span class="pageTitle">لیست حساب مشتریان</span>
    </div>
    <div>
        از تاریخ
        <asp:TextBox ID="txtStartDate" style="direction:ltr; text-align:left" Width="100" runat="server" />
        <asp:RegularExpressionValidator ID="revStartDate" runat="server" ControlToValidate="txtStartDate" Display="Dynamic" ErrorMessage="تاریخ صحیح نمی باشد" ValidationExpression="(13)?[1-9][0-9]/(1[0-2]|0?[1-9])/(3[01]|[12][0-9]|0?[1-9])">*</asp:RegularExpressionValidator>
        <ajaxToolkit:MaskedEditExtender ID="meeStartDate" runat="server"
                            TargetControlID="txtStartDate" 
                            Mask="9999/99/99"
                            MessageValidatorTip="true"
                            CultureName="fa-IR"
                            OnFocusCssClass="MaskedEditFocus"
                            OnInvalidCssClass="MaskedEditError"
                            MaskType="None"
                            AcceptNegative="Left" />
        تا تاریخ
        <asp:TextBox ID="txtEndDate" style="direction:ltr; text-align:left" Width="100" runat="server" />
        <asp:RegularExpressionValidator ID="revEndDate" runat="server" ControlToValidate="txtEndDate" Display="Dynamic" ErrorMessage="تاریخ صحیح نمی باشد" ValidationExpression="(13)?[1-9][0-9]/(1[0-2]|0?[1-9])/(3[01]|[12][0-9]|0?[1-9])">*</asp:RegularExpressionValidator>
        <ajaxToolkit:MaskedEditExtender ID="meeEndDate" runat="server"
                            TargetControlID="txtEndDate" 
                            Mask="9999/99/99"
                            MessageValidatorTip="true"
                            CultureName="fa-IR"
                            OnFocusCssClass="MaskedEditFocus"
                            OnInvalidCssClass="MaskedEditError"
                            MaskType="None"
                            AcceptNegative="Left" />
        <br />
        مشتری : 
        <asp:DropDownList ID="ddlCustomers" runat="server" AppendDataBoundItems="True" DataTextField="CustomerName" DataValueField="Id" >
            <asp:ListItem Value="-1">---</asp:ListItem>
        </asp:DropDownList>&nbsp;
        <br />
        <asp:Button ID="btnSearch" Text="جستجو" runat="server" OnClick="btnSearch_Click" />
        <br />
        <br />
        <div id="divHiddenCustomers" runat="server">
            <asp:RadioButton ID="rbFormalCustomers" GroupName="rbCustomers" OnCheckedChanged="CustomerTypeCheckedChanged" AutoPostBack="true" Text="گروه الف" runat="server" />
            &nbsp;&nbsp;&nbsp;&nbsp;
            <asp:RadioButton ID="rbHiddenCustomers" GroupName="rbCustomers" OnCheckedChanged="CustomerTypeCheckedChanged" AutoPostBack="true" Text="گروه ب" runat="server" />
            &nbsp;&nbsp;&nbsp;&nbsp;
            <asp:RadioButton ID="rbAll" Checked="true" GroupName="rbCustomers" AutoPostBack="true" Text="همه مشتریان" runat="server" OnCheckedChanged="CustomerTypeCheckedChanged" />
        </div>
    
        <hr />
    </div>
    
    <div style="margin:10px 0">
        <asp:GridView ID="gvAccounting" runat="server" AllowPaging="True" PageSize="30" 
            AutoGenerateColumns="False" 
            onpageindexchanging="gvAccounting_PageIndexChanging" 
            onsorting="gvAccounting_Sorting" AllowSorting="True">
            <Columns>
                <asp:BoundField DataField="ID" HeaderText="شناسه" InsertVisible="False" ReadOnly="True"
                    SortExpression="Id" />
                <asp:BoundField DataField="CustomerName" HeaderText="نام مشترک" SortExpression="customer.CustomerName" />
                <asp:CheckBoxField DataField="IsFormal" HeaderText="گروه الف" SortExpression="IsFormal" />
                <asp:TemplateField HeaderText="بدهکاری">
                    <ItemTemplate>
                        <%# Mani.Common.UIHelper.FormatString(Eval("Debit")) %>
                    </ItemTemplate>
                </asp:TemplateField>
                
                <asp:TemplateField HeaderText="بستانکاری">
                    <ItemTemplate>
                        <%# Mani.Common.UIHelper.FormatString(Eval("Credit")) %>
                    </ItemTemplate>
                </asp:TemplateField>
                
                <asp:BoundField DataField="Description" HeaderText="توضیحات" SortExpression="Description" />                
                <asp:TemplateField HeaderText="تاریخ ثبت" SortExpression="CreateDate">
                    <ItemTemplate>
                        <%# Mani.Common.MyPersianDate.DateTimeToPersian(Eval("CreateDate")) %>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        &nbsp;
        
    </div>  
</asp:Content>

